package com.nbsaas.boot.product.data.entity;

import com.nbsaas.boot.code.annotation.*;
import com.nbsaas.boot.jpa.data.entity.AbstractEntity;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import lombok.Data;
import org.hibernate.annotations.Comment;

@CreateByUser
@ComposeView
@Data
@FormAnnotation(title = "页面布局", model = "页面布局")
@Entity
@Table(name = "bs_page_layout")
@Comment("页面布局表")
public class PageLayout extends AbstractEntity {

    @Comment("模板ID")
    @FormField(title = "模板ID", sortNum = "1", required = true)
    private Long templateId;

    @Comment("布局名称")
    @SearchItem(name = "name", key = "name", label = "布局名称")
    @FormField(title = "布局名称", sortNum = "2", grid = true, required = true)
    @Column(length = 100, nullable = false)
    private String name;

    @Comment("布局类型")
    @FormField(title = "布局类型", sortNum = "3", grid = true, type = InputType.select, required = true)
    @Column(length = 20, nullable = false)
    private String layoutType; // HEADER-头部, BODY-主体, FOOTER-底部, SIDEBAR-侧边栏

    @Comment("布局位置")
    @FormField(title = "布局位置", sortNum = "4", grid = true, type = InputType.el_input_number, required = true)
    private Integer position;

    @Comment("布局宽度")
    @FormField(title = "布局宽度", sortNum = "5", grid = true, type = InputType.el_input_number)
    private Integer width;

    @Comment("布局高度")
    @FormField(title = "布局高度", sortNum = "6", grid = true, type = InputType.el_input_number)
    private Integer height;

    @Comment("背景颜色")
    @FormField(title = "背景颜色", sortNum = "7", type = InputType.text)
    @Column(length = 20)
    private String backgroundColor;

    @Comment("背景图片")
    @FormField(title = "背景图片", sortNum = "8", type = InputType.image)
    @Column(length = 500)
    private String backgroundImage;

    @Comment("内边距")
    @FormField(title = "内边距", sortNum = "9")
    @Column(length = 50)
    private String padding; // 格式: "10px 20px 10px 20px"

    @Comment("外边距")
    @FormField(title = "外边距", sortNum = "10")
    @Column(length = 50)
    private String margin; // 格式: "10px 20px 10px 20px"

    @Comment("边框样式")
    @FormField(title = "边框样式", sortNum = "11")
    @Column(length = 100)
    private String border; // 格式: "1px solid #ccc"

    @Comment("圆角")
    @FormField(title = "圆角", sortNum = "12")
    @Column(length = 20)
    private String borderRadius;

    @Comment("阴影")
    @FormField(title = "阴影", sortNum = "13")
    @Column(length = 100)
    private String boxShadow;

    @Comment("是否显示")
    @FormField(title = "是否显示", sortNum = "14", grid = true, type = InputType.select)
    private Boolean visible;

    @Comment("排序")
    @FormField(title = "排序", sortNum = "15", grid = true, type = InputType.el_input_number, sort = true)
    private Integer sort;

    @Comment("布局配置JSON")
    @FormField(title = "布局配置", sortNum = "16", type = InputType.richText, col = 23)
    @Column(columnDefinition = "TEXT")
    private String config;
} 